<template>
  <div>
    <el-form ref="form" :model="form" label-width="80px">
      <el-row>
        <el-col :span="10">
          <el-form-item label="项目名称">
            <el-input v-model="form.operation_name"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="合同关联">
            <el-input v-model="form.operation_hetong"></el-input>
            <el-button align="right"
        type="primary"
        icon="el-icon-search"
        circle></el-button>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="10">
          <el-form-item label="管理级别">
            <el-input v-model="form.operation_gljb"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="审核级别">
            <el-input v-model="form.operation_sjjb"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="10">
          <el-form-item label="建设单位">
            <el-input v-model="form.jianshe_danwei"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="建设地点">
            <el-input v-model="form.jianshe_adder"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="10"> 
          <el-form-item label="建设规模">
            <el-input v-model="form.jianshe_guimo"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="建筑类别">
           <dictionaryTableSelect
              typeKey="xin"
              :fieldValue.sync="customerInfo.c_xin"
            ></dictionaryTableSelect>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="10">
          <el-form-item label="承接部门">
            <el-input v-model="form.chengjie_bumen"></el-input>
            <el-button align="right"
        type="primary"
        icon="el-icon-search"
        circle></el-button>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="结构形式" prop="contract_const">
            <el-tree
  :data="shudata"
  show-checkbox
  ref="tree"
  node-key="structure_id"
  :props="defaultProps">
</el-tree>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="10">
          <el-form-item label="建筑分类" prop="contract_arch">
            <el-tree
  :data="shudata1"
  show-checkbox
  ref="tree1"
  node-key="architecture_id"
  :props="defaultProps1">
</el-tree>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="设计阶段">
            <el-input v-model="form.sheji_jieduan"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="10">
          <el-form-item label="项目来源">
            <dictionaryTableSelect
              typeKey="xin"
              :fieldValue.sync="customerInfo.c_xin"
            ></dictionaryTableSelect>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="合同额">
            <el-input v-model="form.hetong_jine"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="10">
          <el-form-item label="行业性质">
            <dictionaryTableSelect
              typeKey="xin"
              :fieldValue.sync="customerInfo.c_xin"
            ></dictionaryTableSelect>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="甲方负责人">
            <el-input v-model="form.jiafang_fuzeren"></el-input>
            <el-button align="right"
        type="primary"
        icon="el-icon-search"
        circle></el-button>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="10">
          <el-form-item label="电话">
            <el-input v-model="form.jiafang_dh"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="执行设总">
            <el-input v-model="form.zhixing_shezong"></el-input>
            <el-button align="right"
        type="primary"
        icon="el-icon-search"
        circle></el-button>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="10">
          <el-form-item label="电话">
            <el-input v-model="form.zhixing_dh"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="项目开始时间">
            <el-input v-model="form.xiangmu_starttime" type="date"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="10">
          <el-form-item label="项目完成时间">
            <el-input v-model="form.xiangmu_overtime" type="date"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="其他参与部门">
            <el-input v-model="form.qita_canyu"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="10">
          <el-form-item label="项目概况">
            <el-input v-model="form.xaingmu_gaikuang"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="项目备注">
            <el-input v-model="form.xaingmu_beizhu"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <p align="left" style="color: black; font-size: 20px">扩展信息</p>
     <el-form-item label="附件">
            <el-upload
              class="upload-demo"
              :action="uploadUrl"
              multiple
              :on-success="handleAvatarSuccess"
              name="fileList"
              :show-file-list="false"
            >
              <el-button size="small" type="primary">点击上传</el-button>
              <div slot="tip" class="el-upload__tip">
                只能上传jpg/png文件，且不超过500kb
              </div>
            </el-upload>
     </el-form-item>
     <el-button>添加</el-button>
  </div>
</template>

<script>
var lujing1 = "http://localhost:55117/api/ContractControllers/";
var lujing = "http://localhost:55117/api/Customer/";
var lujing2="http://localhost:55117/api/SystemManager/OperationManger/"
export default {
  data() {
    return {
      uploadUrl:
        process.env.VUE_APP_BASE_API + "FileManager/FileManager/FilesUpload",
      form: {},
      shudata1:[],
      shudata:[],
      contractData:[],
        defaultProps: {
          children: 'sonList',
          label: 'structure_name'
        },
        defaultProps1: {
          children: 'sonList',
          label: 'architecture_name'
        },
        customerInfo: {
        fileList: [],
        c_xin:null,
      },
    };
  },
  components: {
    dictionaryTableSelect: () =>
      import("@/components/system_manager/DictionaryTableSelect"),
  },
  created(){
    this.getShu();
    this.getshu1();
  },
  methods: {
    handleAvatarSuccess(res, files, fileList) {
      console.log(res);
      if (res.code == 1) {
        res.data.some((f, i) => {
          this.customerInfo.fileList.push({
            fileName: f.fileOldName,
            upLoadDate: f.upLoadDate,
            fileSize: f.fileSize,
            fileTye: f.fileType,
            userName: this.loginUserName,
          });
        });
      }
    },
    getShu(){
      this.$myaxios.get(lujing1+"GetStruct").then(obj=>{
        this.shudata=obj.data;
      })
    },
    getshu1()
    {
      this.$myaxios.get(lujing1+"GetArchite").then(obj=>{
        this.shudata1=obj.data;
      })
    },
  },
};
</script>